package com.mentalsurvey.mapper;

import com.mentalsurvey.entity.Paper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author vito
 * @version 1.0
 */
@Mapper
public interface PaperMapper {
//    @Insert("INSERT INTO paper (paperCode, title, paperType, description) VALUES (#{paperCode}, #{title}, #{paperType}, #{description})")
    int insert(Paper paper);

    Paper selectById(Integer id);
    List<Paper> selectAll();

    @Select("SELECT title, paper_type FROM paper WHERE id = #{paperId}")
    Paper getPaperById(@Param("paperId") int paperId);

    

    List<Map<String, Object>> selectQuestionsByPaperId(@Param("paperId") Integer paperId);

    List<Map<String, Object>> selectOptionsByPaperCode(@Param("paperCode") String paperCode);
}
